<?php

/**
 * board actions.
 *
 * @package    namasce
 * @subpackage board
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class boardActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    $this->forward('board', 'list');
  }

  public function executeList(sfWebRequest $request)
  {
    $this->messages = MessageTable::getRecent();
  }

  public function executePlate(sfWebRequest $request)
  {
    PlateTrackerTable::updatedMy($request->getParameter('id'));

    $this->plate    = strtoupper($request->getParameter('id'));
    $this->messages = MessageTable::getPlate($request->getParameter('id'));
    $this->tracking = PlateTrackerTable::isTracked($request->getParameter('id'));
  }

  public function executeDriver(sfWebRequest $request)
  {
    $this->driver   = Doctrine::getTable('Profile')->findOneByUrlName($request->getParameter('id'));
    $this->messages = MessageTable::getDriver($request->getParameter('id'));

    $this->driverIsTracked = PlateTrackerTable::isTracked($this->driver->plate);
  }

  public function executeSearch(sfWebRequest $request)
  {
    $this->plates   = MessageTable::getMatching($request->getParameter('q'));
    $this->profiles = ProfileTable::getMatching($request->getParameter('q'));
  }
}
